package HeSuanServer.controller;

import HeSuanServer.POJO.R.Result;
import HeSuanServer.POJO.UmSearch;
import HeSuanServer.POJO.UserMessage;
import HeSuanServer.service.UmService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @描述:
 * @author: LH
 * @date: 2022/12/27
 */
@RequestMapping("um")
@CrossOrigin
@RestController
@Slf4j
public class UmController {
    @Autowired
    private UmService umService;
    @PostMapping("Search")
    public Result Search(@RequestBody UmSearch search){
//        System.out.println(search);
//        return null;
        return umService.Search(search);
    }
    @PostMapping("add")
    public Result add(@RequestBody UserMessage message){
//        System.out.println(message);
        return umService.add(message);
    }
    @GetMapping("getById")
    public Result getById(Integer id){
        return umService.getById(id);
    }
    @PostMapping("edit")
    public Result edit(@RequestBody UserMessage message){
//        System.out.println(message);
//        return null;
        return umService.edit(message);
    }
    @GetMapping("del")
    public Result del(Integer id){
        return umService.del(id);
    }
}
